package com.yzyz.utils;

import java.text.SimpleDateFormat;
import java.util.Date;

import javax.servlet.http.HttpServletRequest;

public class CommonHandle {
	private static SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	public static String now(){
		return sf.format(new Date());
	}
	
	public static SimpleDateFormat getDateFormat(){
		return sf;
	}
	
	public static String getUrl(HttpServletRequest request) {
		String url = request.getRequestURL().toString();
		return url.substring(0, url.indexOf(request.getRequestURI())) + request.getContextPath();
	}
}
